<template>
  <!-- <div style="width: 100%; height: 100%; padding: 5px">
    <h1>测试表单</h1>
    <subform ref="ruleFormRefBox" :ruleForm="ruleForm" :rules="rules" :formSize="formSize"></subform>
    <div>
        <el-button type="primary" @click="submitForm( )">Create</el-button>
      <el-button @click="resetForm()">Reset</el-button>
    </div>
    {{ruleForm}}
  </div> -->
  <div style="margin-top: 100px">
    <div v-if="show">----{{obj.id}}----</div>
    {{obj.name}}
    <el-input v-model="obj.name" placeholder="请输入内容"></el-input>

    {{obj}}
    <el-button type="success" @click="testClick">success</el-button>
  </div>
</template>

<script lang="ts" setup>
import { reactive, ref } from 'vue'
import http from '@/api/request';
const testValue = ref("this is a test");
const show = ref(true);
const list = ref([])

const obj = ref({
  id: 1,
  name: '111'
})

const testClick = async()=>{
  console.log("-----------------",obj)
  show.value = !show.value; 
  list.value = await http.postForm("/api/demo/queryPage",obj);
  console.log(res);
}



//  import { reactive, ref } from 'vue'
// import type { FormInstance, FormRules } from 'element-plus'
// import subform from './subform.vue';

// const formSize = ref('default')
// const ruleFormRefBox = ref()
// const ruleForm = reactive({
//   name: 'Hello',
//   region: '',
//   count: '',
//   date1: '',
//   date2: '',
//   delivery: false,
//   type: [],
//   resource: '',
//   desc: '',
// })

// const rules = reactive<FormRules>({
//   name: [
//     { required: true, message: 'Please input Activity name', trigger: 'blur' },
//     { min: 3, max: 5, message: 'Length should be 3 to 5', trigger: 'blur' },
//   ],
//   region: [
//     {
//       required: true,
//       message: 'Please select Activity zone',
//       trigger: 'change',
//     },
//   ],
//   count: [
//     {
//       required: true,
//       message: 'Please select Activity count',
//       trigger: 'change',
//     },
//   ],
//   date1: [
//     {
//       type: 'date',
//       required: true,
//       message: 'Please pick a date',
//       trigger: 'change',
//     },
//   ],
//   date2: [
//     {
//       type: 'date',
//       required: true,
//       message: 'Please pick a time',
//       trigger: 'change',
//     },
//   ],
//   type: [
//     {
//       type: 'array',
//       required: true,
//       message: 'Please select at least one activity type',
//       trigger: 'change',
//     },
//   ],
//   resource: [
//     {
//       required: true,
//       message: 'Please select activity resource',
//       trigger: 'change',
//     },
//   ],
//   desc: [
//     { required: true, message: 'Please input activity form', trigger: 'blur' },
//   ],
// })

// const options = Array.from({ length: 10000 }).map((_, idx) => ({
//   value: `${idx + 1}`,
//   label: `${idx + 1}`,
// }))

// const submitForm = () => {
//     ruleFormRefBox.value.submitForm();
// }

// const resetForm = () => {
//     ruleFormRefBox.value.resetForm();
// } 

</script>

<style>

</style>